#ifndef ECHOSERVER_H
#define ECHOSERVER_H

#include "threadpool.hpp"
#include "tcpserver.hpp"
namespace moqi
{
using TcpConnecitonPtr = std::shared_ptr<TcpConnection>;
class EchoServer
{
public:
    EchoServer(const string & ip,
               const unsigned int & port,
               size_t threadnum,
               size_t queSize);
    ~EchoServer();
    void start();
    void stop();
    void onConnection(TcpConnecitonPtr con);
    void onMessage(TcpConnecitonPtr con);
    void onClose(TcpConnecitonPtr con);

private:
    Threadpool _pool;
    TcpServer  _server;

};

}//end of namespace moqi
#endif // ECHOSERVER_H

